#ifndef DEERRXHANDLE_H
#define DEERRXHANDLE_H

#define     M_ID     						0x00
#define     M_MotorNum                      0x01
#define     M_Calibration                   0x02
#define     M_Angle                         0x03
#define     M_Speed                         0x04
#define     M_Iq    						0x05
#define     M_Id    						0x06
#define     M_EncError                      0x07
#define     M_BatAdc						0x08
#define     M_Temp                          0x09
#define     M_Error							0x0A
#define     M_ReturnError                   0x0B
#define     M_GetNume						0x0C
#define     M_Nume							0x0D

#define     M_CalibPolarity                 0x23
#define     M_CalibPPnum                    0x24
#define     M_CalibR						0x25
#define     M_CalibL						0x26
#define     M_CalibSucceed                  0x27

#define     M_CtrlCurrent    			0x40
#define     M_CtrlSpeed    				0x41
#define     M_CtrlTraSpeed				0x42
#define     M_CtrlAngle    				0x43

#define     M0                          0x00

#include <QDebug>				//用于调试打印输出的库
#include <QSerialPort>			//访问串口的库
#include <QSerialPortInfo>		//查询串口信息的库
#include "widget.h"
#include "control.h"

class DeerRxHandle
{
public:
    void run();
};

//typedef struct {
//    uint8_t step;
//    uint8_t cnt;
//    uint8_t buff[32];
//    uint8_t rxlen;
//}DeerLink_t;

class DeerLink{
public:
    uint8_t step;
    uint8_t cnt;
    uint8_t buff[32];
    uint8_t rxlen;
    float getFloat(void);
    uint8_t getUint8(void);
    uint16_t getUint16(void);
    int16_t  getint16(void);
};


void DeerParsing(void);
void DeerRx(uint8_t data);
void DeerSwitch(void);


#endif // DEERRXHANDLE_H
